package com.bmw.newbabytimer;

import android.widget.BaseAdapter;

import java.util.List;

/**
 * Created by dss on 14/12/24.
 */
public abstract class GoodsAdapter extends BaseAdapter {
    protected List<Goods> data = null;

    public boolean addData(List<Goods> data) {
        if (null == data || data.size() == 0) {
            return false;
        }
        this.data = data;

        notifyDataSetChanged();

        return true;
    }

    @Override
    public int getCount() {
        if (null == data) {
            return 0;
        }

        return data.size();
    }

    @Override
    public Object getItem(int i) {
        if (null == data || data.size() == 0) {
            return null;
        }

        return data.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }
}
